
var mJqueryUtilData = {loginUrl:"login?relogin=true",device:"pc"};


function ajax(options,fn){
	if(options.isShow == undefined){
		options.isShow = true;
	}
	
	if(options.async == undefined){
		options.async = true;
	}
	
	if(options.timeout == undefined){
		options.timeout = 15000;
	}else{
		options.dataJson.timeout = options.timeout/1000;
	}
	
	if(options.isShow){
		showLoading();
	}
	var headers = options._headers || {};
	try {
		if(isMiniProgram()){
			headers.uid = queryString("uid");
			headers.accountBindUid = queryString("accountBindUid");
			headers.accountBindId = queryString("accountBindId");
			headers.token = queryString("token");
			headers.apitype=  headers.apitype  ||  "api";
		}
	} catch (e) {}
	jQuery.ajax({
		url:options.url
		,data:options.dataJson
		,type:"post"
		,headers:headers	
		,dataType:"json"
		,timeout:options.timeout
		,async:options.async
		,success:function(data){
			
			/*var html = "<div style='position:absolute;z-index:999;left:50%;top:50%;'>";
			html +="<img  src='"+getBasePath()+"res/img/reloading.png' />";
			html +="<p>网络</p>";
			html +="</div>";
			window.confirm("确定要刷新嘛？");*/
			//$(document.body).append(html);
			
			if(data.code == -2){
				var tmpLoginMsg = "请先进行登录";
				if(mJqueryUtilData.device == "wap"){
					tmpLoginMsg = "自动登录";
				}
				//未登录.
				try {
					showMsg(tmpLoginMsg);
					if(options.dataJson.ajaxForApi_2015_05_28 != 'ajaxForApi_2015_05_28'){
						logoutCommon();
					}
				} catch (e) {
					alert(tmpLoginMsg);
					logoutCommon();
				}
				
			}else{
				fn.call(this,data);
			}
		}
		,error:function(XMLHttpRequest, textStatus, errorThrown){
			
//			alert(XMLHttpRequest.status+","+XMLHttpRequest.readyState+','+textStatus+",errorThrown="+errorThrown);
//			alert("网络异常,apiUrl="+options.dataJson.apiUrl);
			
			if(options.isShow){
				if("parsererror" == textStatus){
					showMsg("解析错误,可能数据格式不对","error");
				}
			}
			
			if(options.isShowAjaxError == undefined){
				options.isShowAjaxError = true;
			}
			
			if(options.isShowAjaxError){
				if("timeout" == textStatus){
					showMsg("请求超时","error",{refresh:true});
				}else{
					showMsg("网络出错","error",{refresh:true});
				}
			}
		}
		,complete:function(){
			if(options.isShow ){
				hideLoading();
			}
		}
	});
}


/**
 * 针对修改的ajax
 * @param dataJson
 */
function ajaxForUpdate(dataJson,fn,config){
	var op = {};
	op.url = getBasePath()+"util.json";
	op.dataJson = dataJson;
	var isAlert = true;
	var isAlertError = true;
	var msg = "操作成功";
	if(config){
		op.isShow = config.isShow;
		op.isShowAjaxError = config.isShowAjaxError;
		op.async = config.async;
		op.timeout = config.timeout;
		if(config.isAlert != undefined){
			isAlert = config.isAlert;
		}
		if(config.isAlertError != undefined){
			isAlertError = config.isAlertError;
		}
		if(config.msg != undefined){
			msg = config.msg;
		}
	}
	if(fn){
		ajax(op,function(rs){
			if(rs.code == 0){
				try{
					if(isAlert){
						showMsg(msg);
					}
				}catch(e){
					
				}
				fn.call(this,rs);
			}else{
				if(rs.codeMsg == ""){
					fn.call(this,rs);
				}else{
					if(isAlertError){
						showMsg(rs.codeMsg,"error");
					}else{
						fn.call(this,rs);
					}
				}
			}
		});
	}else{
		ajax(op,function(rs){
			if(rs.code == 0){
				try {
					if(isAlert){
						showMsg(msg);
					}
					select();
				}catch (e) {}
			}else{
				try {
					showMsg(rs.codeMsg,"error");
				} catch (e) {
					alert(rs.codeMsg);
				}
			}
		});
	}
}

/**
 * 针对于查询.
 * @param dataJson
 * @param fn
 */
function ajaxForSelect(dataJson,fn,config){
	try {
		var op = {};
		op.url = getBasePath()+"util.json";
		op.dataJson = dataJson;
		if(config){
			op.isShow = config.isShow;
			op.isShowAjaxError = config.isShowAjaxError;
			op.async = config.async;
			op.timeout = config.timeout;
		}
		ajax(op,function(rs){
			if(rs.code == 0){
				fn.call(this,rs);
			}else{
				try {
					showMsg(rs.codeMsg,"error");
				} catch (e) {
					alert(rs.codeMsg);
				}
			}
		});
	} catch (e) {
		alert('错误' + e.message + '发生在' +   e.lineNumber + '行');  
	}
	
}

/**
 * js 获取basePath.
 * 
 * 
 * 第二版本：修改by Angel in 2016-03-19,之前的算法有问题.
 * 参考:http://blog.csdn.net/lihaiyun718/article/details/7249487
 * 
 * 第三版本：针对于/的访问还是有问题,这个版本进行了优化,但是不是最好的.
 * 
 * @return {TypeName} 
 */
function getBasePath(){
//	var location = (window.location+'').split('/');
//	location =  location[0]+'//'+location[2]+'/'+location[3]+"/";
	var basePath = $("base").attr("href");
	if(basePath == undefined){
		//获取当前网址，如： http://localhost:8080/ems/Pages/Basic/Person.jsp
	    var curWwwPath = window.document.location.href;
	    //获取主机地址之后的目录，如： /ems/Pages/Basic/Person.jsp
	    var pathName = window.document.location.pathname;
	    var pos = curWwwPath.indexOf(pathName);
	    //获取主机地址，如： http://localhost:8080
	    var localhostPath = curWwwPath.substring(0, pos);
	    //获取带"/"的项目名，如：/ems
	    var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
	    //获取项目的basePath   http://localhost:8080/ems/
	    var basePath=localhostPath+projectName+"/";
	}
	return basePath;
}

/**
 * 获取src图片数组.
 * @param selectCondition
 * @returns {Array}
 */
function getImgSrcArray(selectCondition){
	var array = new Array();
	$.each($(selectCondition),function(i,item){
		var src = $(item).attr("data-url");
		if(src == undefined || src == null || src == ""){
			src = item.src;
		}
		array.push(src);
	});
	return array;
}

/**
 * 微信jquery图片预览.
 */
function weixin_jquery_imagePreview(selectCondition){
	try {
		$(selectCondition).click(function(){
			var picArray = getImgSrcArray(selectCondition);
			//alert($(this)[0].src+"--"+picArray[1]);
			var src = $(this).attr("data-url");
			if(src == undefined || src == null || src == ""){
				src =  $(this).attr("src");
			}
			weixin_imagePreview(src,picArray);
		});
	} catch (e) {
		
	}
}

function slideUpToDown(selectCondition,html){
	$(selectCondition).slideUp("slow",function(){
		$(selectCondition).html(html);
		$(selectCondition).slideDown("slow");
	});
}

/**
 * 图片预览.
 * @param selectCondition
 */
function img_preview(selectCondition){
	$(selectCondition).hover(function(e) {
		var div = $("#lintel_prview_2015_02_02");
		if(div.length==0){
			var html = '<div id="lintel_prview_2015_02_02" style="text-align:center;display:inline-table;position: fixed;top:0px;left:0px;padding:10px;border:1px solid #E0E0E0;border-radius:5px;background:#D5D5D5;z-index:999;"></div>';
			$("body").append(html);
			div = $("#lintel_prview_2015_02_02");
		}
		
		
		if(e.pageX<400){
			div.css({"right":5,"left":"auto"});
		}else{
			div.css("left",5);
		}
		div.attr("loadState","0");
		var img = "<img  src='"+$(this).attr("src")+"' style='max-width:600px;max-height:400px;' />";
		div.html(img);
		$("#lintel_prview_2015_02_02").show();
		div.attr("loadState","1");
	},function(){
		var div = $("#lintel_prview_2015_02_02");
		if(div.attr("loadState") == "1"){
			div.hide();
		}
	});
}

/**
 * 获取form 中的表单的value.
 * @returns {___anonymous3021_3022}
 */
function getFormValue(formId,fn,checkFn){
	var dataJson = {};
	$("#"+formId+" input,#"+formId+" textarea,#"+formId+" select").each(function(){
		if(this.type == "radio"){
			if(this.checked){
				dataJson[this.name] = this.value;
				//log(this.id+"---"+this.name+"---"+this.value+"--"+this.type+"--"+this.checked);
			}
		}else if(this.type == "checkbox"){
			if(this.checked){
				if(this.value  == 'on'){
					dataJson[this.id] = 1;
				}else{
					if(this.value != ''){
						dataJson[this.id] = this.value;
					}else{
						dataJson[this.id] = 1;
					}
				}
			}else{
				if(this.value  == 'on'){
					dataJson[this.id] = 0;
				}else{
					if(this.value != ''){
						dataJson[this.id] = '';
					}else{
						dataJson[this.id] = 0;
					}
				}
				
			}
			//log(this.id+"---"+this.name+"---"+this.value+"--"+this.type+"--"+this.checked);
		}else{
			dataJson[this.id] = this.value;
			//log(this.id+"---"+this.name+"---"+this.value+"--"+this.type+"--"+this.checked);
		}
	}); 
	
	if(fn){
		for(var key in dataJson){
		//////emptyCheck
			var obj = $("#"+key);
			var check = obj.attr("emptyCheck");
			var value = dataJson[key];
			if(check != undefined){
				if(value ==  ""){
					jquery_alert(check);
					obj.focus();
					dataJson = null;
					break;
				}
				
			//////mobileCheck
				check = obj.attr("mobileCheck");
				if(check != undefined){
					if(!isPhoneNumber(value)){
						jquery_alert(check);
						dataJson = null;
						obj.focus();
						break;
					}
				}
				
				check = obj.attr("selectCheck");
				if(check != undefined){
					if(value == "" || value == -1){
						jquery_alert(check);
						dataJson = null;
						obj.focus();
						break;
					}
				}
				
				check = obj.attr("emailCheck");
				if(check != undefined){
					if(!isEmail(value)){
						jquery_alert(check);
						dataJson = null;
						obj.focus();
						break;
					}
				}
				
				check = obj.attr("intCheck");
				if(check != undefined){
					if(!isInt(value)){
						jquery_alert(check);
						dataJson = null;
						obj.focus();
						break;
					}
				}
				
				if(checkFn && checkFn[key]){
					var tmp = checkFn[key].call(this,key,obj,value);
					if(!tmp){
						dataJson = null;
						break;
					}
				}
				
			}
		}
		
		
		if(dataJson != null){
			fn.call(this,dataJson);
		}
	}
	return dataJson;
}

/**
 * 滚动到顶部.
 */
function toTop(){
	 $('html, body').animate({scrollTop:0}, 'slow');
}

function initCheckbox(id,defalutValue){
	if(defalutValue == 1){
		$("#"+id).attr("checked","checked");
	}else{
		$("#"+id).removeAttr("checked");
	}
}

function jquery_alert(msg){
	showMsg(msg,"error");
}

function jquery_keydown(obj,options){
	//阻止事件往下操作.
//	return false;
	$(obj).keydown(function(event){
		if(event.keyCode == 37){////左健.
			if(options.leftKey){
				return options.leftKey.call(this,event);
			}
		}else if(event.keyCode == 39){//右键.
			if(options.rightKey){
				return options.rightKey.call(this,event);
			}
		}else if(event.keyCode == 33){//pageUp
			if(options.pageUpKey){
				return options.pageUpKey.call(this,event);
			}
		}else if(event.keyCode == 34){//pageDn
			if(options.pageDnKey){
				return options.pageDnKey.call(this,event);
			}
		}else if(event.keyCode == 32){//空格.
			if(options.spaceKey){
				return options.spaceKey.call(this,event);
			}
			
		}else if(event.keyCode == 13){//Enter
			if(options.enterKey){
				return options.enterKey.call(this,event);
			}
		}
	});
}

/**
 * jquery动画删除.
 * @param selectCondition
 */
function jquery_remove(selectCondition){
	$(selectCondition).slideUp("slow",function(){
		remove();
	});
}

/**
 * 修复图片变形》
 * @param selectCondition
 */
function fixImgForMobile(selectCondition){
	$(selectCondition+" img").each(function(){
		$(this).removeAttr("style");
		$(this).removeAttr("height");
		$(this).attr("width","100%");
	});
}

/**
 * 修复样式. 有的情况下不替换.
 * @param selectCondition
 * @param elements
 * @param cssJson
 */
function fixStyle(selectCondition,elements,cssJson){
	$(selectCondition).find(elements).each(function(){
		for(var key in cssJson){
			//console.log(this.tagName+"-----"+"-key:"+key+"--value:"+$(this).css(key));
			if($(this).css(key) == undefined){
				//处理下.
				$(this).css(key,cssJson[key]);
			}
		}
	});
}

/**
 * 强制替换.
 * @param selectCondition
 * @param elements
 * @param cssJson
 */
function fixStyleForce(selectCondition,elements,cssJson){
	$(selectCondition).find(elements).each(function(){
		$(this).css(cssJson);
	});
}

/**
 * jquery 利用form表单下载文件.
 * @param obj
 */
function form_downFile(obj){
	var form = $("<form>");   
	$('body').append(form);  
    form.attr('style','display:none');   
    //form.attr('target','');
    form.attr('method','post');
    if(obj.action==undefined){
    	obj.action =  "commonByte.json";
    }
    form.attr('action',obj.action);//下载文件的请求路径
    var nameAndValue = obj.nameAndValue;
    if(nameAndValue){
    	for(var key in nameAndValue){
    		var input = $('<input>'); 
    		input.attr('type','hidden'); 
    		input.attr('name',key); 
    		input.attr('value',nameAndValue[key]);
    	    form.append(input);  
    	}
    }
    form.submit();    
}

/**
 * 注销登陆.
 */
function logoutCommon(){
	var rootPath = "login";
	var op = {};
	op.url = "root.json";
	jQuery.ajax({
		url:op.url
		,data:{action:"logout",os:"PC"}
		,type:"post"
		,dataType:"json"
		,timeout:10000
		,success:function(data){
			//alert("logout.success"+JSON.stringify(data));
		}
		,error:function(XMLHttpRequest, textStatus, errorThrown){
			//alert(XMLHttpRequest.status+","+XMLHttpRequest.readyState+','+textStatus+",errorThrown="+errorThrown);
		}
		,complete:function(){
			//alert(mJqueryUtilData.loginUrl);
			if(mJqueryUtilData.loginUrl != ''){
				//alert(mJqueryUtilData.loginUrl);
				gotoPage(mJqueryUtilData.loginUrl);
			}
		}
	});
}

//页面返回顶部
if(jQuery){
	$(function() {
	
	    //先将#back-top隐藏
	    $('#back-top').hide();
	
	    //当滚动条的垂直位置距顶部100像素一下时，跳转链接出现，否则消失
	    $(window).scroll(function() {
	        if ($(window).scrollTop() > 100) {
	            $('#back-top').fadeIn(1000);
	        } else {
	            $("#back-top").fadeOut(1000);
	        }
	    });
	
	    //点击跳转链接，滚动条跳到0的位置，页面移动速度是1000
	    
	});
}



/**
 * js 获取basePath.
 * 
 * 
 * 第二版本：修改by Angel in 2016-03-19,之前的算法有问题.
 * 参考:http://blog.csdn.net/lihaiyun718/article/details/7249487
 * 
 * 第三版本：针对于/的访问还是有问题,这个版本进行了优化,但是不是最好的.
 * 
 * @return {TypeName} 
 */
function getBasePath(){
//	var location = (window.location+'').split('/');
//	location =  location[0]+'//'+location[2]+'/'+location[3]+"/";
	var basePath = $("base").attr("href");
	if(basePath == undefined){
		var local = window.location; 
	    var contextPath = local.pathname.split("/")[1];  
	    basePath = local.protocol+"//"+local.host+"/"+contextPath+"/";  
//		 var local = window.location; 
//		 var pathName = local.pathname.substring(1);  
//	     var webName =  (pathName=='')?'':pathName.substring(0, pathName.indexOf('/'));  
//	     var basePath =  local.protocol + '//' + local.host + '/'+ webName + '/';   
	}
	return basePath;
}

/**
 * 获取src图片数组.
 * @param selectCondition
 * @returns {Array}
 */
function getImgSrcArray(selectCondition){
	var array = new Array();
	$.each($(selectCondition),function(i,item){
		var src = $(item).attr("data-url");
		if(src == undefined || src == null || src == ""){
			src = item.src;
		}
		array.push(src);
	});
	return array;
}

/**
 * 微信jquery图片预览.
 */
function weixin_jquery_imagePreview(selectCondition){
	try {
		$(selectCondition).click(function(){
			var picArray = getImgSrcArray(selectCondition);
			//alert($(this)[0].src+"--"+picArray[1]);
			var src = $(this).attr("data-url");
			if(src == undefined || src == null || src == ""){
				src =  $(this).attr("src");
			}
			weixin_imagePreview(src,picArray);
		});
	} catch (e) {
		
	}
}

function slideUpToDown(selectCondition,html){
	$(selectCondition).slideUp("slow",function(){
		$(selectCondition).html(html);
		$(selectCondition).slideDown("slow");
	});
}

/**
 * 图片预览.
 * @param selectCondition
 */
function img_preview(selectCondition){
	$(selectCondition).hover(function(e) {
		var div = $("#lintel_prview_2015_02_02");
		if(div.length==0){
			var html = '<div id="lintel_prview_2015_02_02" style="text-align:center;display:inline-table;position: fixed;top:0px;left:0px;padding:10px;border:1px solid #E0E0E0;border-radius:5px;background:#D5D5D5;z-index:999;"></div>';
			$("body").append(html);
			div = $("#lintel_prview_2015_02_02");
		}
		
		
		if(e.pageX<400){
			div.css({"right":5,"left":"auto"});
		}else{
			div.css("left",5);
		}
		div.attr("loadState","0");
		var img = "<img  src='"+$(this).attr("src")+"' style='max-width:600px;max-height:400px;' />";
		div.html(img);
		$("#lintel_prview_2015_02_02").show();
		div.attr("loadState","1");
	},function(){
		var div = $("#lintel_prview_2015_02_02");
		if(div.attr("loadState") == "1"){
			div.hide();
		}
	});
}

/**
 * 获取form 中的表单的value.
 * @returns {___anonymous3021_3022}
 */
function getFormValue(formId,fn,checkFn){
	var dataJson = {};
	$("#"+formId+" input,#"+formId+" textarea,#"+formId+" select").each(function(){
		if(this.type == "radio"){
			if(this.checked){
				dataJson[this.name] = this.value;
				//log(this.id+"---"+this.name+"---"+this.value+"--"+this.type+"--"+this.checked);
			}
		}else if(this.type == "checkbox"){
			if(this.checked){
				if(this.value  == 'on'){
					dataJson[this.id] = 1;
				}else{
					if(this.value != ''){
						dataJson[this.id] = this.value;
					}else{
						dataJson[this.id] = 1;
					}
				}
			}else{
				if(this.value  == 'on'){
					dataJson[this.id] = 0;
				}else{
					if(this.value != ''){
						dataJson[this.id] = '';
					}else{
						dataJson[this.id] = 0;
					}
				}
				
			}
			//log(this.id+"---"+this.name+"---"+this.value+"--"+this.type+"--"+this.checked);
		}else{
			dataJson[this.id] = this.value;
			//log(this.id+"---"+this.name+"---"+this.value+"--"+this.type+"--"+this.checked);
		}
	}); 
	
	if(fn){
		for(var key in dataJson){
		//////emptyCheck
			var obj = $("#"+key);
			var check = obj.attr("emptyCheck");
			var value = dataJson[key];
			if(check != undefined){
				if(value ==  ""){
					jquery_alert(check);
					obj.focus();
					dataJson = null;
					break;
				}
				
			//////mobileCheck
				check = obj.attr("mobileCheck");
				if(check != undefined){
					if(!isPhoneNumber(value)){
						jquery_alert(check);
						dataJson = null;
						obj.focus();
						break;
					}
				}
				
				check = obj.attr("selectCheck");
				if(check != undefined){
					if(value == "" || value == -1){
						jquery_alert(check);
						dataJson = null;
						obj.focus();
						break;
					}
				}
				
				check = obj.attr("emailCheck");
				if(check != undefined){
					if(!isEmail(value)){
						jquery_alert(check);
						dataJson = null;
						obj.focus();
						break;
					}
				}
				
				check = obj.attr("intCheck");
				if(check != undefined){
					if(!isInt(value)){
						jquery_alert(check);
						dataJson = null;
						obj.focus();
						break;
					}
				}
				
				if(checkFn && checkFn[key]){
					var tmp = checkFn[key].call(this,key,obj,value);
					if(!tmp){
						dataJson = null;
						break;
					}
				}
				
			}
		}
		
		
		if(dataJson != null){
			fn.call(this,dataJson);
		}
	}
	return dataJson;
}

/**
 * 滚动到顶部.
 */
function toTop(){
	 $('html, body').animate({scrollTop:0}, 'slow');
}

function initCheckbox(id,defalutValue){
	if(defalutValue == 1){
		$("#"+id).attr("checked","checked");
	}else{
		$("#"+id).removeAttr("checked");
	}
}

function jquery_alert(msg){
	showMsg(msg,"error");
}

function jquery_keydown(obj,options){
	//阻止事件往下操作.
//	return false;
	$(obj).keydown(function(event){
		if(event.keyCode == 37){////左健.
			if(options.leftKey){
				return options.leftKey.call(this,event);
			}
		}else if(event.keyCode == 39){//右键.
			if(options.rightKey){
				return options.rightKey.call(this,event);
			}
		}else if(event.keyCode == 33){//pageUp
			if(options.pageUpKey){
				return options.pageUpKey.call(this,event);
			}
		}else if(event.keyCode == 34){//pageDn
			if(options.pageDnKey){
				return options.pageDnKey.call(this,event);
			}
		}else if(event.keyCode == 32){//空格.
			if(options.spaceKey){
				return options.spaceKey.call(this,event);
			}
			
		}else if(event.keyCode == 13){//Enter
			if(options.enterKey){
				return options.enterKey.call(this,event);
			}
		}
	});
}

/**
 * jquery动画删除.
 * @param selectCondition
 */
function jquery_remove(selectCondition){
	$(selectCondition).slideUp("slow",function(){
		remove();
	});
}

/**
 * 修复图片变形》
 * @param selectCondition
 */
function fixImgForMobile(selectCondition){
	$(selectCondition+" img").each(function(){
		$(this).removeAttr("style");
		$(this).removeAttr("height");
		$(this).attr("width","100%");
	});
}

/**
 * 修复样式. 有的情况下不替换.
 * @param selectCondition
 * @param elements
 * @param cssJson
 */
function fixStyle(selectCondition,elements,cssJson){
	$(selectCondition).find(elements).each(function(){
		for(var key in cssJson){
			//console.log(this.tagName+"-----"+"-key:"+key+"--value:"+$(this).css(key));
			if($(this).css(key) == undefined){
				//处理下.
				$(this).css(key,cssJson[key]);
			}
		}
	});
}

/**
 * 强制替换.
 * @param selectCondition
 * @param elements
 * @param cssJson
 */
function fixStyleForce(selectCondition,elements,cssJson){
	$(selectCondition).find(elements).each(function(){
		$(this).css(cssJson);
	});
}

/**
 * jquery 利用form表单下载文件.
 * @param obj
 */
function form_downFile(obj){
	var form = $("<form>");   
	$('body').append(form);  
    form.attr('style','display:none');   
    //form.attr('target','');
    form.attr('method','post');
    if(obj.action==undefined){
    	obj.action =  "commonByte.json";
    }
    form.attr('action',obj.action);//下载文件的请求路径
    var nameAndValue = obj.nameAndValue;
    if(nameAndValue){
    	for(var key in nameAndValue){
    		var input = $('<input>'); 
    		input.attr('type','hidden'); 
    		input.attr('name',key); 
    		input.attr('value',nameAndValue[key]);
    	    form.append(input);  
    	}
    }
    form.submit();    
}

/**
 * 注销登陆.
 */
function logoutCommon(){
	var rootPath = "login";
	var op = {};
	op.url = "root.json";
	jQuery.ajax({
		url:op.url
		,data:{action:"logout",os:"PC"}
		,type:"post"
		,dataType:"json"
		,timeout:10000
		,success:function(data){
			//alert("logout.success"+JSON.stringify(data));
		}
		,error:function(XMLHttpRequest, textStatus, errorThrown){
			//alert(XMLHttpRequest.status+","+XMLHttpRequest.readyState+','+textStatus+",errorThrown="+errorThrown);
		}
		,complete:function(){
			//alert(mJqueryUtilData.loginUrl);
			if(mJqueryUtilData.loginUrl != ''){
				//alert(mJqueryUtilData.loginUrl);
				gotoPage(mJqueryUtilData.loginUrl);
			}
		}
	});
}

//页面返回顶部
if(jQuery){
	$(function() {
	
	    //先将#back-top隐藏
	    $('#back-top').hide();
	
	    //当滚动条的垂直位置距顶部100像素一下时，跳转链接出现，否则消失
	    $(window).scroll(function() {
	        if ($(window).scrollTop() > 100) {
	            $('#back-top').fadeIn(1000);
	        } else {
	            $("#back-top").fadeOut(1000);
	        }
	    });
	
	    //点击跳转链接，滚动条跳到0的位置，页面移动速度是1000
	    
	});
}
